import 'package:flutter/cupertino.dart';
import 'package:flutter_demo/routers/names.dart';
import 'package:flutter_demo/services/user.dart';
import 'package:get/get_navigation/get_navigation.dart';

class LoginMiddleWares extends GetMiddleware{
  @override
  int? priority = 0;

  LoginMiddleWares({required this.priority});

  @override
  RouteSettings? redirect(String? route){
    var isLogin = UserService.to.isLogin;
    return isLogin || route == RouteNames.systemLogin ? null : const RouteSettings(name: RouteNames.systemLogin);
  }
}